package com.lagou.listener;

import com.lagou.boot.ServerBoot;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.RetryNTimes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

@Component
public class BootListener implements ApplicationListener<ContextRefreshedEvent> {

    /**
     * 初始启动
     */
    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        try {
            ServerBoot.startServer("127.0.0.1",8999);
            ServerBoot.startServer("127.0.0.1",9999);
            System.out.println("任务已经启动...");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
